Resistance change memories are known as a type of semiconductor memory devices. A magnetoresistive random access memory (MRAM) is known as a type of resistance change memory. The MRAM is a memory device using magnetoresistive elements having a magnetoresistive effect as memory cells storing information. A writing method of the MRAM includes a spin-transfer torque writing method. The spin-transfer torque writing method has property that a spin-transfer torque current necessary for magnetization switching reduces as the size of the magnetic substance reduces, and has an advantage in high integration, reduction in power consumption, and improvement in performance.
The MRAM is capable of correcting an error for a predetermined number of bits in reading data, because an ECC circuit is equipped. In data writing, write data is encoded, to generate an error correction signal. After an error correction signal is generated, write data and the error correction signal are written to the memory cell array. However, it is not easy to control the encoding time, and timing of the write time following the encoding time.